package com.xian.tszs.meal.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xian.tszs.meal.dto.Statistic;
import com.xian.tszs.meal.mapper.StatisticMapper;
import com.xian.tszs.meal.service.StatisticService;
import com.xian.tszs.utils.DateUtils;
@Service
public class StatisticServiceImpl implements StatisticService {
	
	
	@Autowired
	private StatisticMapper statisticMapper;
	
	@Override
	public List<Statistic> countLastWeekOrderNum(String id) {
		
		Date end = DateUtils.getCurDateWithMinTime();
		Date start = DateUtils.addDays(end, -7);
		
		return statisticMapper.countLastWeekOrderNum(id, start, end);
	}

	@Override
	public List<Statistic> countLastWeekOrderAmount(String id) {
		Date end = DateUtils.getCurDateWithMinTime();
		Date start = DateUtils.addDays(end, -7);
		
		return statisticMapper.countLastWeekOrderAmount(id, start, end);
	}

	@Override
	public Integer countBusinessUser(String id) {
		return statisticMapper.countBusinessUser(id);
	}

}
